<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!-- 新 Bootstrap 核心 CSS 文件 -->

<link rel="stylesheet" href="${pageContext.request.contextPath}/js/plugin/bootstrap-3.3.5/css/bootstrap.css">
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/js/plugin/dataTables-1.10.10/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css"
      href="${pageContext.request.contextPath}/js/plugin/dataTables-1.10.10/css/fix.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css.css">

<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/jquery.serializejson.js"></script>
<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/plugin/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/plugin/dataTables-1.10.10/js/jquery.dataTables.js"></script>
<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/plugin/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript"
        src="${pageContext.request.contextPath}/js/plugin/echart/echarts.common.min.js"></script>
<script language="javascript" type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script language="javascript" type="text/javascript"
        src="${request.contextPath}/statics/plugins/layer/layer.js"></script>


<script>
    function getMeasure(productTypeName) {
        var measureItemIds = '';
        var productTypeIds = "";
        if (productTypeName == 'ks3') {
            measureItemIds = "33,34,35,36,37,39,40,41,46,67,84,87,237,238,239,240";
            productTypeIds = "4,10";
        }
        if (productTypeName == 'CdnFile') {
            measureItemIds = "31,32,38,43,49,52,53,85,88";
            productTypeIds = "9";
        }
        if (productTypeName == 'CdnLive') {
            measureItemIds = "54,55,56,57,58,59,60,86,89";
            productTypeIds = "11";
        }
        if (productTypeName == 'kis') {
            measureItemIds = "169,170,171,172,173,179,180,181,182,183,184,185,186,187,188";
            productTypeIds = "115";
        }
        if (productTypeName == 'eip_share') {
            measureItemIds = "4,69,21,71,48,62";
            productTypeIds = "2";
        }
        if (productTypeName == 'eip_unshare') {
            measureItemIds = "61,47,70,20,3,42,260";
            productTypeIds = "2";
        }
        if (productTypeName == 'eip_share_snail') {
            measureItemIds = "4";
            productTypeIds = "2";
        }
        if (productTypeName == 'bws') {
            measureItemIds = "77,80,81,82,83,503,504,505";
            productTypeIds = "50";
        }
        if (productTypeName == 'kmt') {
            measureItemIds = "199,200,201,202,203,204,205";
            productTypeIds = "137";
        }
        if (productTypeName == 'klt') {
            measureItemIds = "206,207,208";
            productTypeIds = "138";
        }
        if (productTypeName == 'nat') {
            measureItemIds = "174,175,176,177,178,261,500,501,502";
            productTypeIds = "55";
        }
        if (productTypeName == 'kir') {
            measureItemIds = "234";
            productTypeIds = "149";
        }
        return {"productTypeIds": productTypeIds, "measureItemIds": measureItemIds};
    }
</script>
<style>
    .my97Date {
        background: #fff url(${pageContext.request.contextPath}/js/plugin/My97DatePicker/skin/datePicker.gif) no-repeat right;
    }

    body {
        background-color: #f6f6f6;
    }

    .cellStyle {
        text-align: right;
        height: 35px;
    }

    .alert-success {
        color: #3c763d;
        background-color: #0ca2ec;
        border-color: #d6e9c6;
    }
</style>

<script>
    function format(txt, compress/*是否为压缩模式*/) {/* 格式化JSON源码(对象转换为JSON文本) */
        if (!isJSON(txt)) {
            return txt;
        }
        var indentChar = '    ';
        if (/^\s*$/.test(txt)) {
            alert('数据为空,无法格式化! ');
            return;
        }
        try {
            var data = eval('(' + txt + ')');
        }
        catch (e) {
            alert('数据源语法错误,格式化失败! 错误信息: ' + e.description, 'err');
            return;
        }
        ;
        var draw = [], last = false, This = this, line = compress ? '' : '\n', nodeCount = 0, maxDepth = 0;

        var notify = function (name, value, isLast, indent/*缩进*/, formObj) {
            nodeCount++;
            /*节点计数*/
            for (var i = 0, tab = ''; i < indent; i++)tab += indentChar;
            /* 缩进HTML */
            tab = compress ? '' : tab;
            /*压缩模式忽略缩进*/
            maxDepth = ++indent;
            /*缩进递增并记录*/
            if (value && value.constructor == Array) {/*处理数组*/
                draw.push(tab + (formObj ? ('"' + name + '":') : '') + '[' + line);
                /*缩进'[' 然后换行*/
                for (var i = 0; i < value.length; i++)
                    notify(i, value[i], i == value.length - 1, indent, false);
                draw.push(tab + ']' + (isLast ? line : (',' + line)));
                /*缩进']'换行,若非尾元素则添加逗号*/
            } else if (value && typeof value == 'object') {/*处理对象*/
                draw.push(tab + (formObj ? ('"' + name + '":') : '') + '{' + line);
                /*缩进'{' 然后换行*/
                var len = 0, i = 0;
                for (var key in value)len++;
                for (var key in value)notify(key, value[key], ++i == len, indent, true);
                draw.push(tab + '}' + (isLast ? line : (',' + line)));
                /*缩进'}'换行,若非尾元素则添加逗号*/
            } else {
                if (typeof value == 'string')value = '"' + value + '"';
                draw.push(tab + (formObj ? ('"' + name + '":') : '') + value + (isLast ? '' : ',') + line);
            }
            ;
        };
        var isLast = true, indent = 0;
        notify('', data, isLast, indent, false);
        return draw.join('');
    }

    function defualtSelected(id, value) {
        var selected = document.getElementById(id);
        for (var i = 0; i < selected.options.length; i++) {
            if (selected.options[i].value == value) {
                selected.options[i].selected = true;
                break;
            }
        }
    }

    function isJSON(str) {
        try {
            var obj = JSON.parse(str);
            if (typeof obj == 'object' && obj) {
                return true;
            } else {
                return false;
            }
        } catch (e) {
            console.log('error：' + str + '!!!' + e);
            return false;
        }
    }
</script>